package com.pr.makfilm.core.validator;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.validation.IValidatable;

/**
 * Created by p.radomski on 23.02.14.
 */
public class DateFormatValidator extends AbstractValidator<String>
{
   @Override
   public void validate(IValidatable<String> validatable)
   {
      String input = validatable.getValue();
      if (StringUtils.isBlank(input) && !input.matches("\\d{2}-\\d{2}-\\d{4}")) {
         error(validatable, "dateformat.not.valid");
      }
   }
}
